package com.njupt.Sort;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @Author: wujiaming
 * @CreateTime: 2024/11/15 16:41
 * @Description: 归并排序AOP
 * @Version: 1.0
 */

@Component
@Aspect
public class MergeSortAop {

    @Before(value = "execution(public void com.njupt.Sort.MergeSort.*(..))")
    public void before(JoinPoint joinPoint){
        String name = joinPoint.getSignature().getName();
        System.out.println("方法名：" + name + " 方法参数： " + Arrays.toString(joinPoint.getArgs()));
    }

    @After(value = "execution(public void com.njupt.Sort.MergeSort.*(..)))")
    public void after(JoinPoint joinPoint){
        String name = joinPoint.getSignature().getName();
        System.out.println("以上是方法的结果，本方法的方法名是:" + name);
    }

}
